import util from "../../utils/util";
Page({

  /**
   * 页面的初始数据
   */
  data: {
    desc:'',
    questionNumber:0,
    questionList:[],
    isExercise:false,//是否有练习题
  },
  onLoad(e) {
    let isExercise = e.isExercise;
    if(isExercise){
      this.setData({
        isExercise
      })
    }
    this.getTopicData();
  },
  // 获取认知题目
  getTopicData(){
    const questionNumber = wx.getStorageSync('questionInfo').questionNumber;
    const questionList = wx.getStorageSync('questionInfo').questionList;
    const topicContent = questionList[questionNumber];
    if (topicContent) {
      const describe = JSON.parse(topicContent.describe);
      const desc = describe[0].content;
      this.setData({
        desc,
        questionNumber
      });
    }
  },
  onStar() {
    const {questionNumber} = this.data;
    // 调用公共方法进行跳转
    util.navigateByTypeCode(questionNumber);
  }
})